package com.yix.logging.entity;

import com.yix.common.base.BaseIdentityIdEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;

/**
 * @author wdx
 * @version 1.0
 * @Description TODO
 * @date 2021/1/19 13:21
 */
@Entity
@Data
@Table(name = "log")
@org.hibernate.annotations.Table(appliesTo = "log",comment = "log表")
@NoArgsConstructor
public class Log extends BaseIdentityIdEntity {

    @Column(columnDefinition = "varchar(100) COMMENT '操作用户'")
    @ApiModelProperty(value = "操作用户")
    private String username;

    @Column(columnDefinition = "varchar(2000) COMMENT '描述'")
    @ApiModelProperty(value = "描述")
    private String description;

    @Column(columnDefinition = "varchar(200) COMMENT '方法名'")
    @ApiModelProperty(value = "方法名")
    private String method;

    @Column(columnDefinition = "varchar(2000) COMMENT '参数'")
    @ApiModelProperty(value = "参数")
    private String params;

    @Column(columnDefinition = "varchar(50) COMMENT '日志类型'")
    @ApiModelProperty(value = "日志类型")
    private String logType;

    @Column(columnDefinition = "varchar(50) COMMENT '请求ip'")
    @ApiModelProperty(value = "请求ip")
    private String requestIp;

    @Column(columnDefinition = "varchar(300) COMMENT '地址'")
    @ApiModelProperty(value = "地址")
    private String address;

    @Column(columnDefinition = "varchar(100) COMMENT '浏览器'")
    @ApiModelProperty(value = "浏览器")
    private String browser;

    @Column(columnDefinition = "BIGINT COMMENT '请求耗时'")
    @ApiModelProperty(value = "请求耗时")
    private Long time;

    @Column(columnDefinition = "BLOB COMMENT '异常详细'")
    @ApiModelProperty(value = "异常详细")
    private byte[] exceptionDetail;


    public Log(String logType, Long time) {
        this.logType = logType;
        this.time = time;
    }
}
